﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using SocialCee.ExternalSystems.Common;
using Microsoft.Practices.Unity;

namespace SocialCee.Framework.Tests
{
    [TestClass]
    public class Container
    {
        SocialCee.Framework.ExternalSystems extSystems;
        [TestInitialize]
        public void Init()
        {
            extSystems = new SocialCee.Framework.ExternalSystems();
        }
        [TestMethod]
        public void Load()
        {
            Framework.Container container = new Framework.Container();
            container.RegisterClients(extSystems.SocialMediaClients);

            Assert.IsNotNull(Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(List<string>), "SocialMediaClientsNames"));
            Assert.IsTrue(((List<string>)Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(List<string>), "SocialMediaClientsNames")).Count > 0);

            Assert.IsNotNull(Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(Dictionary<string, IClient>), "SocialMediaClients"));
            Assert.IsTrue(((Dictionary<string, IClient>)Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(Dictionary<string, IClient>), "SocialMediaClients")).Count > 0);

            Assert.IsTrue(((List<string>)Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(List<string>), "SocialMediaClientsNames")).Count
                ==
                ((Dictionary<string, IClient>)Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance(typeof(Dictionary<string, IClient>), "SocialMediaClients")).Count);
        }
    }
}
